from todo_api_project.BASE.myBase import Tools



class login_module(Tools):
    path = '/user/login'

    def login_action(self,username,password,checkcode='1234'):
        pwd_md5 = self.using_md5(password)
        data = {
            'username': username,
            'password': pwd_md5,
            'checkcode': checkcode,
        }
        res = self.session.post(url=self.hosturl+self.path,json=data).json()
        return res

    def get_head(self):
        msg = self.login_action(username='23080543',password='123456')
        head = {
            "userId": msg['userId'],
            "userToken": msg['userToken']
        }
        return head